

// import {Observable} from 'rxjs'

// const observable = new Observable(subscribe=>{
//     subscribe.next(1)
//     subscribe.next(2)
//     subscribe.next(3)

//     setTimeout(()=>{
//         subscribe.next(4)
//         subscribe.complete()
//     },1000)
// })


// observable.subscribe({
//     next:(value)=>{
//        console.log(value)
//     }
// })


import { Observable, interval, take } from "rxjs";
import { map, filter,reduce,find,findIndex } from 'rxjs/operators'
 
 
const subs = interval(500).pipe(map(v => ({ num: v })), filter(v => (v.num % 2 == 0))).subscribe((e) => {
    console.log(e)
    if (e.num == 10) {
        subs.unsubscribe()
    }
})